#!/bin/bash
set -e

psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
    CREATE ROLE slave login replication encrypted password '123456';
EOSQL

echo "host replication slave 0.0.0.0/0 md5" >> "$PGDATA/pg_hba.conf"
